<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2021/3/16 0016
 * Time: 22:36
 */

namespace app\admin\controller;




use app\admin\model\Banner;
use app\BaseController;
use think\facade\Db;
use think\facade\Request;
use think\facade\View;

class Edit extends BaseController
{
   public  function info(){
       return View::fetch();
   }
    public  function pass(){
        return View::fetch();
    }
    public  function adv(){
       //查询数据
        $banner=Banner::getBannerList();
      View::assign("banner",$banner);
      //添加
      if (Request::isPost()){
          $param=Request::param();
          $data=[
             'name'=>$param['name'],
              'sort'=>$param['sort'],
              'add_time'=>date("Y-m-d H:i:s",time())
          ];
          list($res,$msg)=Banner::addBanner($data);
          if ($res){
              $this->success($msg,url('adv'),[],3);
          }else{
              $this->error($msg,url('adv'),[],3);
          }

      }else{
          return View::fetch();
      }

    }
}